package com.ivy.service.impl;

import com.ivy.dao.UserDao;
import com.ivy.dao.impl.UserDaoImpl;
import com.ivy.entity.User;
import com.ivy.service.UserService;

public class UserServiceImpl implements UserService{
	private UserDao userDao = new UserDaoImpl();
	
	@Override
	public boolean addUser(User user) {
		if(userDao.findUserByTelephone(user.getTelephone()) == null){
			userDao.insert(user);
			return true;
		} else {
			return false;
		}
	}

	@Override
	public User findUser(User user) {
		if(userDao.findUser(user) != null){
			return userDao.findUser(user);		
		} else {
			return null;
		}
	}

}
